#ifndef GEOMETRY_H_
#define GEOMETRY_H_

#include <vector>

class GeometryBase
{
	/* virtual GeometryBase* vertex_iterator() = 0;
	virtual GeometryBase* vertex_begin() = 0;
	virtual GeometryBase* vertex_end() = 0; */
};
template <int DIM>
class Vertex  ;
template <int DIM, typename T>
class Geometry ;

template <int DIM, typename T>
class Geometry : public GeometryBase
{
protected:
	std::vector<Vertex<DIM> > vertex;
public:
	Geometry() = default;
	Geometry(std::vector<std::vector<T> > &vec)
	{
		vertex.resize(vec.size());
		int i =0;
		for(auto &v: vec)
		{
			vertex[i++].set_coordinate(v);
		}
	};
	void set_vertex(std::vector<std::vector<T> > &vec)
	{
		vertex.resize(vec.size());
		int i =0;
		for(auto &v: vec)
		{
			vertex[i++].set_coordinate(v);
		}
	};
	/* virtual Geometry* vertex_iterator() {};
	virtual Geometry* vertex_begin() {};
	virtual Geometry* vertex_end() {};	 */
};

template <int DIM>
class Vertex : public Geometry<DIM, double>
{
protected:
	std::vector<double> coordinate;
public:
    Vertex() : coordinate(DIM) { this->vertex.resize(0); };
	void set_coordinate(std::vector<double> _coord)
		{
			coordinate = _coord;
		};
	std::vector<double> get_coordiante() { return coordinate;};
};

class Square : public Geometry<2, double>
{
public:
	Square() { this->vertex.resize(4); };
	Square(std::vector<std::vector<double> > &vec) : Geometry<2,double> (vec) { };	
};

class Triangle : public Geometry<2,double>
{
public:
	Triangle() { this->vertex.resize(3);};
	Triangle(std::vector<std::vector<double> > &vec) : Geometry<2,double> (vec) { };
};

#endif
